package com.ssm.controller;

import com.ssm.pojo.AirTicket;
import com.ssm.pojo.PageInfo;
import com.ssm.service.AirTicketService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;

@Controller
public class AirTicketController {

    @Autowired
    private AirTicketService airTicketService;

    @RequestMapping("getAirTicket.html")
    public String getAirTicket(AirTicket airTicket, @RequestParam(defaultValue = "1") Integer pn, Model model) {
        if (pn < 1) {
            pn = 1;
        }
        PageInfo<AirTicket> users = airTicketService.getUserList(airTicket, pn, 8);
        System.err.println(airTicket.getDepartDate());
        model.addAttribute("pageInfo", users);
        return "leading/ticket";
    }

//    @RequestMapping("list.html")
//    public String list(){
//        return "leading/commodityDetails";
//    }
}
